public class Demo11 {
    public static void main(String[] args) {
        Object locker = new Object();
        Object locker2 = new Object();
        Thread t1 = new Thread(() -> {
            synchronized (locker) {
                System.out.println("T1线程获得了锁");
                synchronized (locker2) {
                    System.out.println("t1线程获得了第二把锁");
                }
            }
        });

        Thread t2 = new Thread(() -> {
            synchronized (locker2) {
                System.out.println("T2线程获得了锁");
                synchronized (locker) {
                    System.out.println("t2线程获得了第二把锁");
                }
            }
        });
        t1.start();
        t2.start();
    }
}
